# -*- coding: UTF-8 -*-
import direct.directbase.DirectStart
import sys
class KeyBoard:
    def __init__(self,game_obj): 
        self.game_obj = game_obj
        self.game_obj.keyMap = {"left":0, "right":0,"left-shift":0, "right-shift":0, "forward":0,"backward":0, "cam-left":0, "cam-right":0, "space":0}
        ##
        self.game_obj.keyMap["atk1"]=0
        self.game_obj.keyMap["atk2"]=0
        pass
    
    def initKeyBoard(self):
        self.game_obj.accept("escape", sys.exit)
        self.game_obj.accept("a", self.setKey, ["left",1])
        self.game_obj.accept("d", self.setKey, ["right",1])
        self.game_obj.accept("w", self.setKey, ["forward",1])
        self.game_obj.accept("s", self.setKey, ["backward",1])
        self.game_obj.accept("s-up", self.setKey, ["backward",0])
        self.game_obj.accept("arrow_left", self.setKey, ["cam-left",1])
        self.game_obj.accept("arrow_right", self.setKey, ["cam-right",1])
        self.game_obj.accept("arrow_left-up", self.setKey, ["cam-left",0])
        self.game_obj.accept("arrow_right-up", self.setKey, ["cam-right",0])
        self.game_obj.accept("w-up", self.setKey, ["forward",0])
        self.game_obj.accept("a-up", self.setKey, ["left",0])
        self.game_obj.accept("d-up", self.setKey, ["right",0])
        self.game_obj.accept("space",self.setKey,["space",1])
        self.game_obj.accept("space-up",self.setKey,["space",0])
        self.game_obj.accept("j",self.setKey,["atk1",1])
        self.game_obj.accept("j-up",self.setKey,["atk1",0]) 
        self.game_obj.accept("k",self.setKey,["atk2",1])
        self.game_obj.accept("k-up",self.setKey,["atk2",0]) 
        self.game_obj.accept("q",self.setKey,["left-shift",1])
        self.game_obj.accept("q-up",self.setKey,["left-shift",0]) 
        self.game_obj.accept("e",self.setKey,["right-shift",1])
        self.game_obj.accept("e-up",self.setKey,["right-shift",0]) 
    def setKey(self, key, value):
        self.game_obj.keyMap[key] = value
    
    def keyHandler(self):
       
        return 